<template>
    <div class="charge">
        <div class="header-title">
            <span @click="$router.go(-1)" class="mint-toast-icon mintui mintui-back"></span>
            <span>选择币种</span>
            <span></span>
        </div>
        <div class="title-two">
            <div class="title-choose">
                <div @click="titleColor = 1" :class="{'title-choose-now':titleColor==1}">法币账户</div>
                <div @click="titleColor = 2" :class="{'title-choose-now':titleColor==2}">房产账户</div>
            </div>
        </div>
        <div class="charge-content">
            <div class="charge-content-choose">
                <span>BTC</span>
                <div @click="closeType =! closeType">
                    <span>选择币种</span>
                    <span class="fa fa-angle-right"></span>
                </div>
            </div>
            <div class="charge-code">
                <img id="img-saved" src="../../../assets/img/code.png" alt />
                <p>点击保存二维码</p>
            </div>
            <div class="charge-address">
                <p class="copyAddress">{{address}}</p>
                <input id="copyAddress" type="text" :value="address" />
                <mt-button
                    data-clipboard-target="#copyAddress"
                    @click.native="copyAdr"
                    class="charge-btn"
                    size="normal"
                    type="primary"
                >复制地址</mt-button>
            </div>
        </div>
        <div class="charge-explain">
            <p>温馨提示</p>
            <p>1.请勿向上诉地址充值任何非BTC资产，否则资产无法找回</p>
            <p>2.您充值至上述地址后，需要整个网络节点的确认，1次网络确认后，到账。6次网络确认可以提币。</p>
            <p>3.最小充值金额：0 BTC小于最小金额的将不会上账</p>
        </div>
        <!-- 选择币种 -->
        <typeSelect v-show="closeType" @getCloseStatus = getCloseStatus @getBinType = getBinType></typeSelect>
    </div>
</template>
<script>
import { Toast } from "mint-ui";
import typeSelect from '../../../components/typeSelect'
export default {
    data() {
        return {
            //修改title颜色
            titleColor: 1,
            //地址
            address: "45sed556124f561266rfthgg556....5689",
            //关闭类型选项
            closeType:false,
            //子组件所穿的值
            binType:"",
        };
    },
    components:{
       typeSelect 
    },
    methods: {
        //复制文字
        copyAdr() {
            let clipboard = new this.clipboard(".charge-btn");
            clipboard.on("success", function() {
                Toast({
                    message: "复制成功！",
                    duration: 1000
                });
            });
            clipboard.on("error", function() {
                Toast({
                    message: "操作失败！",
                    duration: 3000
                });
            });
        },
        //接收子组件关闭状态
        getCloseStatus(status){
            this.closeType = status
        },
        //接收子组件所传的值
        getBinType(num){
            this.binType = num
            console.log(this.binType)
        }
       
    }
};
</script>
<style lang="less" scoped>
.charge {
    background-color: #f7f7fb;
    height: 100%;
    width: 100%;
    position: absolute;
    left: 0;
    top: 0;
    overflow-y: scroll;
}
.header-title {
    font-size: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 45px;
    padding: 0 15px;
    box-sizing: border-box;
    border-bottom: 1px solid #eee;
    background-color: #fff;
}
.title-two {
    background-color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 60px;
    .title-choose {
        height: 25px;
        width: 70%;
        border: 1px solid #365679;
        border-radius: 5px;
        overflow: hidden;
        display: flex;
        justify-content: center;
        align-items: center;
        box-sizing: border-box;

        > div {
            width: 50%;
            font-size: 14px;
            color: #365679;
            text-align: center;
            line-height: 25px;
        }
        .title-choose-now {
            background-color: #365679;
            color: #fff;
        }
    }
}

.charge-content {
    padding: 15px;
    box-sizing: border-box;
    background-color: #fff;
    .charge-content-choose {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding-bottom: 10px;
        border-bottom: 1px solid #eee;
        > span {
            font-size: 18px;
            font-weight: 600;
            color: #333333;
        }
        > div {
            font-size: 12px;
            color: #999999;
        }
    }
    .charge-code {
        img {
            width: 35%;
            margin: 20px auto;
            display: block;
        }
        p {
            font-size: 14px;
            color: #55a9e2;
            text-align: center;
        }
    }
    .charge-address {
        padding: 15px 0 0;
        box-sizing: border-box;
        text-align: center;
        p {
            font-size: 12px;
            color: #7b91a9;
            background-color: #f7f7fb;
            padding: 5px 0;
        }
        .charge-btn {
            width: 35%;
            margin-top: 20px;
            font-size: 16px;
            background-color: #365679;
        }
    }
}
.charge-explain {
    font-size: 12px;
    color: #7b91a9;
    padding: 15px;
    box-sizing: border-box;
    p {
        line-height: 25px;
    }
}
</style>
